﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

using Pg.BioMedics.SDR.Entities;
using Pg.BioMedics.SDR.Entities.Codes;

namespace Pg.BioMedics.SDR.Services
{
    /// <summary>
    /// Defines SDR search methods
    /// </summary>
    [ServiceContract]
    public interface ISearchService : IService
    {
        /// <summary>
        /// Executes textual query agains indexed spoken documents 
        /// descriptos. In this case textual query is simply list of terms
        /// which are searched within indexed set.
        /// </summary>
        /// <param name="query">Textual query </param>
        /// <returns>List of search results</returns>
        [OperationContract]
        IList<SearchResult> ExecuteTextQuery(string query);

        /// <summary>
        /// Executes spoken query against indexed spoken documents descriptions.
        /// In this case matching between query and stored annotations / documents
        /// will be extracted.
        /// </summary>
        /// <param name="audioData"></param>
        /// <param name="timeout">Query timeout in miliseconds, if -1 there is no timeout</param>
        /// <returns>List of search results sorted by relevance score</returns>
        [OperationContract]
        IList<SearchResult> ExecuteSpokenQuery(byte[] audioData, int timeout);

        /// <summary>
        /// Gets a document realted to the SearchResult returned by the one of the 
        /// execute query methods
        /// </summary>
        /// <param name="searchResult">Valid search result</param>
        /// <returns>Document instance</returns>
        [OperationContract]
        Document GetDocument(SearchResult searchResult);
    }
}
